<script>
	
	export default {
		components: {
			
		},
		data() {
			return {
				ls_id:''
			}
		},
		methods: {
			onShareAppMessage: function (ops) {
			   if (ops.from === 'button') {
			     // 来自页面内转发按钮
			     console.log(ops.target)
			     console.log(this.data.id) //
			     //this.data.id 可以在Page({})里data中设定id
			 
			   }
			   return {
			     title: '标签',
			     path: '/pages/detail/detail?id='+this.data.id, //这里设定都是以"/page"开头,并拼接好传递的参数
			     success: function (res) {
			       // 转发成功
			       console.log(res);
			       console.log("转发成功:" + JSON.stringify(res));
			     },
			     fail: function (res) {
			       // 转发失败
			       console.log("转发失败:" + JSON.stringify(res));
			     }
			   }
			 },
		},
		mounted() {
			if (wx.canIUse('getUpdateManager')) {
			const updateManager = wx.getUpdateManager()
			updateManager.onCheckForUpdate(function (res) {
			console.log('onCheckForUpdate====', res)
			// 请求完新版本信息的回调
			if (res.hasUpdate) {
			console.log('res.hasUpdate====')
			updateManager.onUpdateReady(function () {
			wx.showModal({
			title: '更新提示',
			content: '新版本已经准备好，是否重启应用？',
			success: function (res) {
			console.log('success====', res)
			// res: {errMsg: "showModal: ok", cancel: false, confirm: true}
			if (res.confirm) {
			// 新的版本已经下载好，调用 applyUpdate 应用新版本并重启
			updateManager.applyUpdate()
			}
			}
			})
			})
			updateManager.onUpdateFailed(function () {
			// 新的版本下载失败
			wx.showModal({
			title: '已经有新版本了哟~',
			content: '新版本已经上线啦~，请您删除当前小程序，重新搜索打开哟~'
			})
			})
			}
			})
			} else {
			wx.showModal({
			title: '提示',
			content: '当前微信版本过低，无法使用该功能，请升级到最新微信版本后重试。'
			})
			}//end 强制更新
			var that = this;
			  // 查看是否授权
			  wx.getSetting({
			   success: function (res) {
			    if (res.authSetting['scope.userInfo']) {
			     wx.getUserInfo({
			      success: function (res) {
					console.log('已授权')
					console.log(that)
					that.ifcompany =false
			      },
			     });
			    }else{
				console.log('未授权请先授权')
					uni.showModal({
					    title: '请先授权',
					    content: '本小程序作为收集员工信息和填写温度所用,需要您的授权',
					    success: function (res) {
					        if (res.confirm) {
					            console.log('用户点击确定');
								// 跳转授权页面
								uni.navigateTo({
									url:'/pages/index/empower'
								})
					        } else if (res.cancel) {
					            console.log('用户点击取消');
					        }
					    }
					});
			}
			   },
			
			  }),
			console.log(wx.getStorageSync("person"))
		},
		onLoad: function(option) {
			console.log(option.id);
			if(option.id){
				this.ls_id =option.id
			}
		},
	}
</script>

<style>
    /* #ifndef APP-PLUS-NVUE */
    /* uni.css - 通用组件、模板样式库，可以当作一套ui库应用 */
    @import './common/uni.css';
	@import "components/m-icon/m-icon.css";
	@import './common/hvl.css';

    /* 以下样式用于 hello uni-app 演示所需 */
    page {
        background-color: #F4F5F6;
        height: 100%;
        font-size: 28upx;
        line-height: 1.8;
    }
	@font-face {
	  font-family: 'font_family';
	  src: url('static/iconfont.eot');
	  src: url('static/iconfont.eot?#iefix') format('embedded-opentype'),
	      url('static/iconfont.woff2') format('woff2'),
	      url('static/iconfont.woff') format('woff'),
	      url('static/iconfont.ttf') format('truetype'),
	      url('static/iconfont.svg#font_family') format('svg');
	}
	.font_family {
	  font-family: "font_family" !important;
	  font-size: 16px;
	  font-style: normal;
	  -webkit-font-smoothing: antialiased;
	  -moz-osx-font-smoothing: grayscale;
	}
    .uni-header-logo {
        padding: 30upx;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        margin-top: 10upx;
    }

    .uni-header-image {
        width: 100px;
        height: 100px;
    }

    .uni-hello-text {
        color: #7A7E83;
    }

    .uni-hello-addfile {
        text-align: center;
        line-height: 300upx;
        background: #FFF;
        padding: 50upx;
        margin-top: 10px;
        font-size: 38upx;
        color: #808080;
    }

    /* #endif*/
	/* 原生组件模式下需要注意组件外部样式 */
	m-input {
		width: 100%;
		/* min-height: 100%; */
		display: flex;
		flex: 1;
	}
	
	.content {
		display: flex;
		flex: 1;
		flex-direction: column;
		background-color: #efeff4;
		padding: 10px;
	}
	
	.input-group {
		background-color: #ffffff;
		margin-top: 20px;
		position: relative;
	}
	
	.input-group::before {
		position: absolute;
		right: 0;
		top: 0;
		left: 0;
		height: 1px;
		content: '';
		-webkit-transform: scaleY(.5);
		transform: scaleY(.5);
		background-color: #c8c7cc;
	}
	
	.input-group::after {
		position: absolute;
		right: 0;
		bottom: 0;
		left: 0;
		height: 1px;
		content: '';
		-webkit-transform: scaleY(.5);
		transform: scaleY(.5);
		background-color: #c8c7cc;
	}
	
	.input-row {
		display: flex;
		flex-direction: row;
		position: relative;
		font-size: 18px;
		line-height: 40px;
	}
	
	.input-row .title {
		width: 72px;
		padding-left: 15px;
	}
	
	.input-row.border::after {
		position: absolute;
		right: 0;
		bottom: 0;
		left: 8px;
		height: 1px;
		content: '';
		-webkit-transform: scaleY(.5);
		transform: scaleY(.5);
		background-color: #c8c7cc;
	}
	
	.btn-row {
		margin-top: 25px;
		padding: 10px;
	}
	button.primary {
		background-color: #0faeff;
	}
</style>

